<?php
include dirname(__DIR__) . '/inc/header.php';
?>
  <!-- Theme style -->
  <link rel="stylesheet" href="<?php echo $GLOBALS['config']['AdminLTE'];?>/dist/css/AdminLTE.min.css">
<?php
if ($GLOBALS['config']['pagemode'] === 'iframe' && count($GLOBALS['config']['paths']) >= 2) {
    echo('<body style="background-color:transparent">');
    loadfile();
?>
<script>
jQuery(function () {
    $("div").on('click', function () {
        top.$("body").removeClass('sidebar-open');
    });
});
</script>
<?php
    exit('</body></html>');
}

?>

<!-- AdminLTE App -->
<script src="<?php echo $GLOBALS['config']['AdminLTE'];?>/dist/js/adminlte.min.js"></script>

  <!-- jvectormap -->
  <link rel="stylesheet" href="<?php echo $GLOBALS['config']['AdminLTE'];?>/bower_components/jvectormap/jquery-jvectormap.css">
  <!-- AdminLTE Skins. Choose a skin from the css/skins
       folder instead of downloading all of them to reduce the load. -->
  <link rel="stylesheet" href="<?php echo $GLOBALS['config']['AdminLTE'];?>/dist/css/skins/_all-skins.min.css">

  <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
  <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
  <!--[if lt IE 9]>
  <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
  <![endif]-->

  <!-- Google Font -->
  <!--<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">-->
  <link rel="stylesheet" href="<?php echo $GLOBALS['config']['url_static'];?>/css/gfonts.css">
</head>

<body class="hold-transition skin-blue sidebar-mini sidebar-collapse">
<div class="wrapper">

<?php include dirname(__DIR__) . '/inc/panel-vue_main.php';?>

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">


<script>
const vue_content_header = VueInit(<?=json_encode($GLOBALS['config'])?>);
vue_content_header.el = '#vue_content_header';
vue_content_header.data.menu = [];
vue_content_header.data.pathparts = window.parseURL().pathparts;
</script>
<span id="vue_content_header">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1 v-if="0&&pathparts[3]&&menu[pathparts[1]]">
        {{menu[pathparts[1]].child[pathparts[2]].child[pathparts[3]].title}}
        <small>{{menu[pathparts[1]].child[pathparts[2]].name}}-{{menu[pathparts[1]].child[pathparts[2]].child[pathparts[3]].name}}</small>
      </h1>
      <ol class="breadcrumb" style="position: static; float: none">
        <li><a href="<?php if($GLOBALS['config']['pagemode'] !== 'none') {?>#<?php }?>/panel/index.html"><i class="fa fa-dashboard"></i> 系统</a></li>
        <li v-if="pathparts[2]&&menu[pathparts[1]]" class="active">{{menu[pathparts[1]].child[pathparts[2]].title}}</li>
        <li v-if="pathparts[3]&&menu[pathparts[1]]" class="active">{{menu[pathparts[1]].child[pathparts[2]].child[pathparts[3]].title}}</li>
      </ol>
    </section>
<?php if ($GLOBALS['config']['pagemode'] === 'vuerouter') {?>
    <section class="content">
        <router-view></router-view>
    </section>
<?php }?>
</span>
<script>
new Vue(vue_content_header);
</script>

<?php if ($GLOBALS['config']['pagemode'] === 'none' || $GLOBALS['config']['pagemode'] === 'iframe') {?>
    <!-- Main content -->
    <section class="content">
<?php
if ($GLOBALS['config']['pagemode'] === 'iframe') {
?>
<script type="text/javascript">
function SetCwinHeight() {
    const iframeid = document.getElementById("iframe_content");
    if (iframeid !== null) {
        if (iframeid.contentDocument.body !== null) {
            iframeid.height = iframeid.contentDocument.body.scrollHeight;
        }
    }
    setTimeout(SetCwinHeight, 100);
}
SetCwinHeight();
</script>
<iframe
id="iframe_content"
name="iframe_content"
width="100%" height="0"
frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no" allowtransparency="yes"
src="about:blank"
></iframe>
<?php
} else {
    loadfile();
}
?>
    </section>
    <!-- /.content -->
<?php }?>
  </div>
  <!-- /.content-wrapper -->

  <footer class="main-footer">
    <div class="pull-right hidden-xs">
      <b>Version</b> 2.0.0
    </div>
    <strong>Copyright &copy; 2017-2020
    <a href="javascript:void(0)"><?=$GLOBALS['config']['title_full']?></a>
<?php
if (!empty($GLOBALS['config']['footer'])) {
    echo "{$GLOBALS['config']['footer']}";
}
?>
    </strong>
  </footer>

  <!-- Control Sidebar -->
<?php //include dirname(__DIR__) . '/inc/control.php';?>
  <!-- /.control-sidebar -->
  <!-- Add the sidebar's background. This div must be placed
       immediately after the control sidebar -->
  <div class="control-sidebar-bg"></div>

</div>
<!-- ./wrapper -->

<script>
jQuery(function () {
    $(document).on('expanded.pushMenu', function () {
        // 展开菜单
        localStorage.setItem("push-menu", "expanded");
    });
    $(document).on('collapsed.pushMenu', function () {
        // 收起菜单
        localStorage.setItem("push-menu", "collapsed");
    });
});
switch(localStorage.getItem("push-menu")) {
    case('collapsed'):
        $("body").addClass('sidebar-collapse');
    break;
    case(''):
    case('expanded'):
        $("body").removeClass('sidebar-collapse');
    break;
}
</script>
</body>
</html>
